package main

import (
	"bufio"
	"fmt"
	"net"
	"os"
	"strings"
)

func main() {
	//net.DialTCP("tcp")
	conn, _ := net.Dial("tcp", ":12345")
	defer conn.Close()
	inputReader := bufio.NewReader(os.Stdin)
	for {
		var line, _ = inputReader.ReadString('\n')
		line = strings.Trim(line, "\r\n")
		conn.Write([]byte(line))
		var buf = make([]byte, 512)
		n, _ := conn.Read(buf)
		fmt.Println(string(buf[:n]))
	}
}
